package cn.cxyxj.sso_client_1.event;

import lombok.extern.slf4j.Slf4j;
import org.springframework.context.ApplicationListener;
import org.springframework.security.authentication.event.AuthenticationFailureBadCredentialsEvent;
import org.springframework.security.core.AuthenticationException;
import org.springframework.security.oauth2.client.filter.OAuth2AuthenticationFailureEvent;
import org.springframework.stereotype.Component;

@Component
@Slf4j
public class AuthenticationFailureListener implements ApplicationListener<OAuth2AuthenticationFailureEvent> {

 
    @Override
    public void onApplicationEvent(OAuth2AuthenticationFailureEvent authenticationFailureBadCredentialsEvent) {
        System.out.println("登录失败");
        AuthenticationException exception = authenticationFailureBadCredentialsEvent.getException();
        log.error("exception ",exception);
    }
}